load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load(
    "@fbsource//xplat/folly:defs.bzl",
    "folly_xplat_library",
)
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "global_thread_pool_list",
    srcs = [
        "GlobalThreadPoolList.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "GlobalThreadPoolList.h",
    ],
    deps = ["//xplat/folly:cpp_attributes"],
    exported_deps = [
        "//xplat/folly:indestructible",
        "//xplat/folly:synchronized",
        "//xplat/folly:thread_local",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "async",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Async.h",
    ],
    deps = [
        "//xplat/folly:futures_core",
        "//xplat/folly/executors:global_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "threaded_executor",
    srcs = [
        "ThreadedExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ThreadedExecutor.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:executor",
        "//xplat/folly:scope_guard",
        "//xplat/folly:system_thread_name",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/executors/thread_factory:named_thread_factory",
        "//xplat/folly/executors/thread_factory:thread_factory",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "function_scheduler",
    srcs = [
        "FunctionScheduler.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FunctionScheduler.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:conv",
        "//xplat/folly:function",
        "//xplat/folly:hash_hash",
        "//xplat/folly:random",
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly:system_thread_name",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/container:intrusive_heap",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "future_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FutureExecutor.h",
    ],
    deps = [
        "//xplat/folly:functional_invoke",
        "//xplat/folly:futures_core",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_thread_pool_deadlock_detector_observer",
    srcs = ["IOThreadPoolDeadlockDetectorObserver.cpp"],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["IOThreadPoolDeadlockDetectorObserver.h"],
    deps = [
        "//xplat/folly:system_thread_id",
    ],
    exported_deps = [
        "//xplat/folly:singleton",
        "//xplat/folly/concurrency:deadlock_detector",
        "//xplat/folly/executors:io_thread_pool_executor",
        "//xplat/folly/executors:thread_pool_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "timekeeper_scheduled_executor",
    srcs = [
        "TimekeeperScheduledExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "TimekeeperScheduledExecutor.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:futures_core",
        "//xplat/folly/executors:scheduled_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "timed_drivable_executor",
    srcs = [
        "TimedDrivableExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "TimedDrivableExecutor.h",
    ],
    deps = [
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/executors:drivable_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "inline_executor",
    srcs = [
        "InlineExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "InlineExecutor.h",
    ],
    deps = ["//xplat/folly:indestructible"],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "manual_executor",
    srcs = [
        "ManualExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ManualExecutor.h",
    ],
    deps = [
        "//xplat/folly:synchronization_lifo_sem",
        "//xplat/folly/executors:drivable_executor",
        "//xplat/folly/executors:scheduled_executor",
        "//xplat/folly/executors:sequenced_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "queue_observer",
    srcs = [
        "QueueObserver.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "QueueObserver.h",
    ],
    deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_sys_types",
        "//xplat/folly:synchronized",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "soft_real_time_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SoftRealTimeExecutor.h",
    ],
    deps = [
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "sequenced_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SequencedExecutor.h",
    ],
    deps = [
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "serialized_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SerializedExecutor.h",
    ],
    exported_deps = [
        "//xplat/folly/executors:sequenced_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "global_executor",
    srcs = [
        "GlobalExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "GlobalExecutor.h",
    ],
    deps = [
        "//xplat/folly:function",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:singleton",
        "//xplat/folly:system_hardware_concurrency",
        "//xplat/folly/detail:async_trace",
        "//xplat/folly/executors:cpu_thread_pool_executor",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/executors:io_thread_pool_executor",
    ],
    exported_deps = [
        "//xplat/folly:executor",
        "//xplat/folly:portability_gflags",
        "//xplat/folly/executors:io_executor",
        "//xplat/folly/executors:thread_pool_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "serial_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SerialExecutor.h",
        "SerialExecutor-inl.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:exception_string",
        "//xplat/folly:scope_guard",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/executors:serialized_executor",
        "//xplat/folly/io/async:request_context",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "strand_executor",
    srcs = [
        "StrandExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "StrandExecutor.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:exception_string",
        "//xplat/folly:optional",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/executors:serialized_executor",
        "//xplat/folly/io/async:request_context",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "drivable_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "DrivableExecutor.h",
    ],
    deps = [
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "executor_with_priority",
    srcs = [
        "ExecutorWithPriority.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ExecutorWithPriority.h",
        "ExecutorWithPriority-inl.h",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fiber_io_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FiberIOExecutor.h",
    ],
    deps = [
        "//xplat/folly/executors:io_executor",
        "//xplat/folly/fibers:fiber_manager_map",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "queued_immediate_executor",
    srcs = [
        "QueuedImmediateExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "QueuedImmediateExecutor.h",
    ],
    deps = [
        "//xplat/folly:scope_guard",
    ],
    exported_deps = [
        "//xplat/folly:executor",
        "//xplat/folly:indestructible",
        "//xplat/folly:thread_local",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/io/async:request_context",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "codel",
    srcs = [
        "Codel.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Codel.h",
    ],
    deps = [
        "//xplat/folly:portability_gflags",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "edf_thread_pool_executor",
    srcs = [
        "EDFThreadPoolExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "EDFThreadPoolExecutor.h",
    ],
    deps = [
        "//xplat/folly:portability_gflags",
        "//xplat/folly:scope_guard",
        "//xplat/folly:synchronization_lifo_sem",
        "//xplat/folly:synchronization_throttled_lifo_sem",
        "//xplat/folly/concurrency:process_local_unique_id",
        "//xplat/folly/executors:soft_real_time_executor",
        "//xplat/folly/executors:thread_pool_executor",
        "//xplat/folly/tracing:static_tracepoint",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "cpu_thread_pool_executor",
    srcs = [
        "CPUThreadPoolExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "CPUThreadPoolExecutor.h",
    ],
    deps = [
        "//xplat/folly:optional",
        "//xplat/folly:portability_gflags",
        "//xplat/folly:synchronization_throttled_lifo_sem",
        "//xplat/folly/executors:queue_observer",
        "//xplat/folly/executors:thread_pool_executor",
        "//xplat/folly/executors/task_queue:priority_lifo_sem_mpmc_queue",
        "//xplat/folly/executors/task_queue:priority_unbounded_blocking_queue",
        "//xplat/folly/executors/task_queue:unbounded_blocking_queue",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "thread_pool_executor",
    srcs = [
        "ThreadPoolExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ThreadPoolExecutor.h",
    ],
    deps = [
        "//xplat/folly:synchronization_asymmetric_thread_fence",
        "//xplat/folly/tracing:static_tracepoint",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:default_keep_alive_executor",
        "//xplat/folly:memory",
        "//xplat/folly:portability_gflags",
        "//xplat/folly:portability_pthread",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:synchronization_atomic_struct",
        "//xplat/folly:synchronization_baton",
        "//xplat/folly/concurrency:process_local_unique_id",
        "//xplat/folly/executors:global_thread_pool_list",
        "//xplat/folly/executors/task_queue:lifo_sem_mpmc_queue",
        "//xplat/folly/executors/thread_factory:named_thread_factory",
        "//xplat/folly/io/async:request_context",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "scheduled_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ScheduledExecutor.h",
    ],
    deps = [
        "//xplat/folly:executor",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IOExecutor.h",
    ],
    deps = [
        "//xplat/folly:executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "executors",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/executors:async",
        "//xplat/folly/executors:cpu_thread_pool_executor",
        "//xplat/folly/executors:fiber_io_executor",
        "//xplat/folly/executors:future_executor",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/executors:io_executor",
        "//xplat/folly/executors:io_object_cache",
        "//xplat/folly/executors:io_thread_pool_executor",
        "//xplat/folly/executors:serial_executor",
        "//xplat/folly/executors:thread_pool_executor",
        "//xplat/folly/executors:threaded_executor",
        "//xplat/folly/executors/task_queue:blocking_queue",
        "//xplat/folly/executors/task_queue:lifo_sem_mpmc_queue",
        "//xplat/folly/executors/task_queue:priority_lifo_sem_mpmc_queue",
        "//xplat/folly/executors/task_queue:unbounded_blocking_queue",
        "//xplat/folly/executors/thread_factory:named_thread_factory",
        "//xplat/folly/executors/thread_factory:priority_thread_factory",
        "//xplat/folly/executors/thread_factory:thread_factory",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_object_cache",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IOObjectCache.h",
    ],
    deps = [
        "//xplat/folly:thread_local",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/io/async:async_base",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_thread_pool_executor",
    srcs = [
        "IOThreadPoolExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IOThreadPoolExecutor.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:portability_gflags",
        "//xplat/folly/detail:memory_idler",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly/executors:io_executor",
        "//xplat/folly/executors:queue_observer",
        "//xplat/folly/executors:thread_pool_executor",
        "//xplat/folly/io/async:event_base_manager",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "metered_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MeteredExecutor.h",
        "MeteredExecutor-inl.h",
    ],
    exported_deps = [
        "//xplat/folly:default_keep_alive_executor",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/executors:queue_observer",
        "//xplat/folly/io/async:async_base",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "virtual_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "VirtualExecutor.h",
    ],
    deps = [
        "//xplat/folly:default_keep_alive_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "threaded_repeating_function_runner",
    srcs = [
        "ThreadedRepeatingFunctionRunner.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ThreadedRepeatingFunctionRunner.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:function",
        "//xplat/folly:system_thread_name",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "execution_observer",
    srcs = [
        "ExecutionObserver.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ExecutionObserver.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//xplat/folly/tracing:static_tracepoint",
    ],
)

# !!!! fbcode/folly/executors/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

fbcode_target(
    _kind = cpp_library,
    name = "executors",
    exported_deps = [
        ":async",  # @manual
        ":cpu_thread_pool_executor",  # @manual
        ":fiber_io_executor",  # @manual
        ":future_executor",  # @manual
        ":global_executor",  # @manual
        ":io_executor",  # @manual
        ":io_object_cache",  # @manual
        ":io_thread_pool_executor",  # @manual
        ":serial_executor",  # @manual
        ":thread_pool_executor",  # @manual
        ":threaded_executor",  # @manual
        "//folly/executors/task_queue:blocking_queue",  # @manual
        "//folly/executors/task_queue:lifo_sem_mpmc_queue",  # @manual
        "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue",  # @manual
        "//folly/executors/task_queue:unbounded_blocking_queue",  # @manual
        "//folly/executors/thread_factory:named_thread_factory",  # @manual
        "//folly/executors/thread_factory:priority_thread_factory",  # @manual
        "//folly/executors/thread_factory:thread_factory",  # @manual
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "async",
    headers = ["Async.h"],
    exported_deps = [
        ":global_executor",
        "//folly/futures:core",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "codel",
    srcs = ["Codel.cpp"],
    headers = ["Codel.h"],
    deps = [
        "//folly/portability:gflags",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "cpu_thread_pool_executor",
    srcs = ["CPUThreadPoolExecutor.cpp"],
    headers = ["CPUThreadPoolExecutor.h"],
    deps = [
        "//folly:executor",
        "//folly:memory",
        "//folly:optional",
        "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue",
        "//folly/executors/task_queue:priority_unbounded_blocking_queue",
        "//folly/executors/task_queue:unbounded_blocking_queue",
        "//folly/portability:gflags",
        "//folly/synchronization:throttled_lifo_sem",
    ],
    exported_deps = [
        ":queue_observer",
        ":thread_pool_executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "drivable_executor",
    headers = ["DrivableExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "edf_thread_pool_executor",
    srcs = ["EDFThreadPoolExecutor.cpp"],
    headers = ["EDFThreadPoolExecutor.h"],
    deps = [
        "//folly:scope_guard",
        "//folly/concurrency:process_local_unique_id",
        "//folly/portability:gflags",
        "//folly/synchronization:lifo_sem",
        "//folly/synchronization:throttled_lifo_sem",
        "//folly/tracing:static_tracepoint",
    ],
    exported_deps = [
        ":soft_real_time_executor",
        ":thread_pool_executor",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fiber_io_executor",
    headers = ["FiberIOExecutor.h"],
    exported_deps = [
        ":io_executor",
        "//folly/fibers:fiber_manager_map",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "future_executor",
    headers = ["FutureExecutor.h"],
    exported_deps = [
        "//folly/functional:invoke",
        "//folly/futures:core",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "global_executor",
    srcs = ["GlobalExecutor.cpp"],
    headers = ["GlobalExecutor.h"],
    deps = [
        ":cpu_thread_pool_executor",
        ":inline_executor",
        ":io_thread_pool_executor",
        "//folly:function",
        "//folly:shared_mutex",
        "//folly:singleton",
        "//folly/detail:async_trace",
        "//folly/system:hardware_concurrency",
    ],
    exported_deps = [
        ":io_executor",
        "//folly:executor",
        "//folly/portability:gflags",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "global_thread_pool_list",
    srcs = ["GlobalThreadPoolList.cpp"],
    headers = ["GlobalThreadPoolList.h"],
    deps = [
        "//folly:cpp_attributes",
        "//folly/system:thread_id",
    ],
    exported_deps = [
        "//folly:indestructible",
        "//folly:synchronized",
        "//folly:thread_local",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "inline_executor",
    srcs = ["InlineExecutor.cpp"],
    headers = ["InlineExecutor.h"],
    deps = [
        "//folly:indestructible",
    ],
    exported_deps = [
        "//folly:c_portability",
        "//folly:cpp_attributes",
        "//folly:executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "manual_executor",
    srcs = ["ManualExecutor.cpp"],
    headers = ["ManualExecutor.h"],
    exported_deps = [
        "//folly/executors:drivable_executor",
        "//folly/executors:scheduled_executor",
        "//folly/executors:sequenced_executor",
        "//folly/synchronization:lifo_sem",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "io_executor",
    headers = ["IOExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "io_object_cache",
    headers = ["IOObjectCache.h"],
    exported_deps = [
        ":global_executor",
        "//folly:thread_local",
        "//folly/io/async:async_base",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "io_thread_pool_executor",
    srcs = ["IOThreadPoolExecutor.cpp"],
    headers = ["IOThreadPoolExecutor.h"],
    deps = [
        "//folly/detail:memory_idler",
        "//folly/portability:gflags",
    ],
    exported_deps = [
        ":io_executor",
        ":queue_observer",
        ":thread_pool_executor",
        "//folly:portability",
        "//folly/io/async:event_base_manager",
        "//folly/synchronization:relaxed_atomic",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "soft_real_time_executor",
    srcs = ["SoftRealTimeExecutor.cpp"],
    headers = ["SoftRealTimeExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "scheduled_executor",
    headers = ["ScheduledExecutor.h"],
    exported_deps = [
        "//folly:executor",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "serial_executor",
    headers = [
        "SerialExecutor.h",
        "SerialExecutor-inl.h",
    ],
    exported_deps = [
        ":global_executor",
        ":serialized_executor",
        "//folly:exception_string",
        "//folly:scope_guard",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:request_context",
        "//folly/synchronization:distributed_mutex",
        "//folly/synchronization:relaxed_atomic",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "sequenced_executor",
    headers = ["SequencedExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "serialized_executor",
    headers = ["SerializedExecutor.h"],
    exported_deps = [
        ":sequenced_executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "strand_executor",
    srcs = ["StrandExecutor.cpp"],
    headers = ["StrandExecutor.h"],
    deps = [
        ":global_executor",
        "//folly:exception_string",
    ],
    exported_deps = [
        ":serialized_executor",
        "//folly:optional",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:request_context",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "thread_pool_executor",
    srcs = ["ThreadPoolExecutor.cpp"],
    headers = ["ThreadPoolExecutor.h"],
    deps = [
        "//folly/concurrency:process_local_unique_id",
        "//folly/portability:pthread",
        "//folly/synchronization:asymmetric_thread_fence",
        "//folly/tracing:static_tracepoint",
    ],
    exported_deps = [
        ":global_thread_pool_list",
        "//folly:default_keep_alive_executor",
        "//folly:memory",
        "//folly:shared_mutex",
        "//folly/executors/task_queue:lifo_sem_mpmc_queue",
        "//folly/executors/thread_factory:named_thread_factory",
        "//folly/io/async:request_context",
        "//folly/portability:gflags",
        "//folly/synchronization:atomic_struct",
        "//folly/synchronization:baton",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "threaded_executor",
    srcs = ["ThreadedExecutor.cpp"],
    headers = ["ThreadedExecutor.h"],
    deps = [
        "//folly:scope_guard",
        "//folly/executors/thread_factory:named_thread_factory",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:executor",
        "//folly/concurrency:unbounded_queue",
        "//folly/container:f14_hash",
        "//folly/executors/thread_factory:thread_factory",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "timed_drivable_executor",
    srcs = ["TimedDrivableExecutor.cpp"],
    headers = ["TimedDrivableExecutor.h"],
    exported_deps = [
        ":drivable_executor",
        "//folly/concurrency:unbounded_queue",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "timekeeper_scheduled_executor",
    srcs = ["TimekeeperScheduledExecutor.cpp"],
    headers = ["TimekeeperScheduledExecutor.h"],
    exported_deps = [
        ":scheduled_executor",
        "//folly/futures:core",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "queued_immediate_executor",
    srcs = ["QueuedImmediateExecutor.cpp"],
    headers = ["QueuedImmediateExecutor.h"],
    deps = [
        "//folly:indestructible",
        "//folly:scope_guard",
    ],
    exported_deps = [
        ":inline_executor",
        "//folly:executor",
        "//folly:thread_local",
        "//folly/io/async:request_context",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "executor_with_priority",
    srcs = ["ExecutorWithPriority.cpp"],
    headers = [
        "ExecutorWithPriority.h",
        "ExecutorWithPriority-inl.h",
    ],
    exported_deps = [
        "//folly:executor",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "metered_executor",
    headers = [
        "MeteredExecutor.h",
        "MeteredExecutor-inl.h",
    ],
    exported_deps = [
        ":queue_observer",
        "//folly:default_keep_alive_executor",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:async_base",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "io_thread_pool_deadlock_detector_observer",
    srcs = ["IOThreadPoolDeadlockDetectorObserver.cpp"],
    headers = ["IOThreadPoolDeadlockDetectorObserver.h"],
    exported_deps = [
        "//folly:singleton",
        "//folly/concurrency:deadlock_detector",
        "//folly/executors:io_thread_pool_executor",
        "//folly/executors:thread_pool_executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "queue_observer",
    srcs = ["QueueObserver.cpp"],
    headers = [
        "QueueObserver.h",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:portability",
        "//folly:synchronized",
        "//folly/portability:sys_types",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "virtual_executor",
    headers = [
        "VirtualExecutor.h",
    ],
    exported_deps = [
        "//folly:default_keep_alive_executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "function_scheduler",
    srcs = ["FunctionScheduler.cpp"],
    headers = ["FunctionScheduler.h"],
    deps = [
        "//folly:conv",
        "//folly:random",
        "//folly:string",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:range",
        "//folly/container:f14_hash",
        "//folly/container:intrusive_heap",
        "//folly/hash:hash",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "threaded_repeating_function_runner",
    srcs = ["ThreadedRepeatingFunctionRunner.cpp"],
    headers = ["ThreadedRepeatingFunctionRunner.h"],
    deps = [
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "execution_observer",
    srcs = ["ExecutionObserver.cpp"],
    headers = ["ExecutionObserver.h"],
    deps = [
        "//folly/tracing:static_tracepoint",
    ],
    exported_external_deps = [
        "boost",
    ],
)
